''' Mission 8 -- Answer Bot Solution with functions ''' from codex import * import random from time import sleep answers = ["The odds are yes", "It is not in the stars", "Go for the gold!", "Today is your day", "Stay home and read", "Have an adventure"] # === Functions def pixel_colors(): pixels.set(0, random.choice(COLOR_LIST)) pixels.set(1, random.choice(COLOR_LIST)) pixels.set(2, random.choice(COLOR_LIST)) pixels.set(3, random.choice(COLOR_LIST)) # === Main Program while True: pixel_colors() if buttons.was_pressed(BTN_A): display.clear() display.print(random.choice(answers)) if buttons.was_pressed(BTN_B): break sleep(0.1) # === end display.clear() pixels.off()